/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.wisnu.spms.source.model;

import com.wisnu.spms.service.dao.DbEmployeeDao;
import com.wisnu.spms.service.util.SpringUtil;
import com.wisnu.spms.source.Employee;

/**
 *
 * @author Wisnu Wardoyo
 *
 */
public class MainFrameModel {

    public boolean loginCheck() throws Exception {
        DbEmployeeDao dao = SpringUtil.getDbEmployeeDao();
        Employee.setEmployee(dao.getEmployee());
        return Employee.getEmployee() != null;
    }

    public void logout() throws Exception {
        DbEmployeeDao dao = SpringUtil.getDbEmployeeDao();
        Employee.getEmployee().setEmployeeIsLogin("No");
        dao.updateEmployee(Employee.getEmployee());
        Employee.setEmployee(null);
    }

}
